package com.edu.buservice.util.model.enums;

import lombok.Getter;

/**
 * @program: KQAIA
 * @description:
 * @author: 无恙
 * @create: 2025-02-09 19:28
 **/
@Getter
public enum ErrorCodeEnum {
	// 系统基础状态
	SUCCESS("success", "业务成功"),
	SYSTEM_ERROR("system_error", "系统内部错误"),
	SERVICE_UNAVAILABLE("service_unavailable", "服务暂时不可用"),
	REQUEST_TIMEOUT("request_timeout", "请求处理超时"),
	NETWORK_ERROR("network_error", "网络通信异常"),

	// 参数校验类
	PARAM_ERROR("param_error", "参数校验失败"),
	PARAM_MISSING("param_missing", "必要参数缺失"),
	PARAM_FORMAT_INVALID("param_format_invalid", "参数格式错误"),
	DATA_TYPE_MISMATCH("data_type_mismatch", "数据类型不匹配"),
	//租户ID不能为null
	TENANT_ID_CANNOT_BE_NULL("tenant_id_cannot_be_null", "租户ID不能为null"),
	TENANT_NOT_FOUND("tenant_not_found", "租户不存在"),

	// 权限认证类
	AUTH_ERROR("auth_error", "认证失败"),
	ACCESS_DENIED("access_denied", "访问权限不足"),
	TOKEN_INVALID("token_invalid", "令牌无效或过期"),
	SESSION_EXPIRED("session_expired", "会话已过期"),
	IP_LIMITED("ip_limited", "IP访问受限"),
	PERMISSION_DENIED("permission_denied", "操作权限不足"),
	ROLE_NOT_GRANTED("role_not_granted", "角色未授权"),
	SCOPE_EXCEEDED("scope_exceeded", "访问范围超出限制"),

	// 用户账户类
	USER_NOT_ACTIVATED("user_not_activated", "用户未登录"),
	USER_NOT_FOUND("user_not_found", "用户不存在"),
	USER_EXIST("user_exist", "用户已存在"),
	LOGIN_FAILED("login_failed", "登录失败"),
	ACCOUNT_LOCKED("account_locked", "账户已被锁定"),
	PASSWORD_ERROR("password_error", "密码错误"),
	PASSWORD_EXPIRED("password_expired", "密码已过期"),
	PASSWORD_RESET_REQUIRED("password_reset_required", "需要重置密码"),
	//租户不存在
	TENANT_NOT_EXIST("tenant_not_exist", "租户不存在"),

	// 多渠道登录类
	SOCIAL_LOGIN_FAILED("social_login_failed", "社交登录失败"),
	THIRD_PARTY_LOGIN_FAILED("third_party_login_failed", "第三方登录失败"),
	DEVICE_NOT_REGISTERED("device_not_registered", "设备未注册"),
	LOGIN_CHANNEL_UNSUPPORTED("login_channel_unsupported", "登录渠道不支持"),
	LOGIN_CREDENTIALS_INVALID("login_credentials_invalid", "登录凭证无效"),

	// 资金操作类
	INSUFFICIENT_BALANCE("insufficient_balance", "账户余额不足"),
	TRANSACTION_FAILED("transaction_failed", "交易操作失败"),
	LIMIT_EXCEEDED("limit_exceeded", "超出业务限额"),
	FROZEN_ACCOUNT("frozen_account", "账户已被冻结"),
	PAYMENT_ERROR("payment_error", "支付渠道异常"),

	// 数据操作类
	DATA_NOT_FOUND("data_not_found", "请求数据不存在"),
	DATA_EXISTS("data_exists", "数据已存在"),
	DATA_CONFLICT("data_conflict", "数据版本冲突"),
	DATABASE_ERROR("database_error", "数据库操作异常"),

	// 文件操作类
	FILE_UPLOAD_ERROR("file_upload_error", "文件上传失败"),
	FILE_SIZE_EXCEEDED("file_size_exceeded", "文件大小超出限制"),
	UNSUPPORTED_FILE_TYPE("unsupported_file_type", "不支持的文件类型"),

	// 风控类
	RISK_CONTROL_REJECT("risk_control_reject", "风控审核未通过"),
	SUSPICIOUS_OPERATION("suspicious_operation", "检测到可疑操作"),

	// 第三方服务
	THIRD_PARTY_SERVICE_ERROR("third_party_error", "第三方服务异常"),
	SMS_SEND_FAILED("sms_send_failed", "短信发送失败"),

	// 特殊业务状态
	DUPLICATE_REQUEST("duplicate_request", "重复请求"),
	BIZ_STATUS_CONFLICT("biz_status_conflict", "业务状态冲突"),
	OPERATION_NOT_ALLOWED("operation_not_allowed", "当前状态不允许此操作");

	private final String code;
	private final String message;

	ErrorCodeEnum(String code, String message) {
		this.code = code;
		this.message = message;
	}
}
